#include <bits/stdc++.h>
using namespace std;

struct country { 
  int l, r, u, d;
  void input() { 
    cin >> l >> r >> u >> d;
  }
} con[10];

int col[10], n;

bool check(country a, country b) { 
  int ans = 0;
  ans += (a.l == b.r);
  ans += (b.l == a.r);
  ans += (a.u == b.d);
  ans += (b.u == a.d);
  return (ans == 1);
}

void judge() { 
  for (int i = 1; i <= n; i++) { 
    for (int j = i + 1; j <= n; j++) { 
      if (col[i] == col[j] and check(con[i], con[j])) return;
    }
  }
  for (int i = 1; i <= n; i++) 
    cout << col[i] << ' ';
  putchar('\n');
  exit(0);
}

void dfs(int x) { 
  if (x == n + 1) { 
    judge();
    return;
  }
  for (int i = 0; i < 4; i++) { 
    col[x] = i;
    dfs(x + 1);
  }
}

int main() { 
  cin >> n;
  for (int i = 1; i <= n; i++) 
    con[i].input();
  dfs(1);
}
